﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using ZD_DataModel;

namespace ZD_Business
{
    public interface IBusinessBase
    {
        #region 通用CRUD
        #region 查询
        /// <summary>
        /// 返回实体泛型集合
        /// </summary>
        /// <typeparam name="IDataModel"></typeparam>
        /// <returns></returns>
        List<T> GetList<T>(IDataModel Model) where T : IDataModel, new();

        /// <summary>
        /// 分页查询返回实体类泛型集合
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <returns></returns>
        List<T> GetPageList<T>(IDataModel Model, ref int DataTotalCount) where T : IDataModel, new();

        /// <summary>o
        /// 返回DataSet
        /// </summary>
        /// <param name="Model"></param>
        /// <returns></returns>
        DataSet GetDataSet(IDataModel Model);

        /// <summary>
        /// 分页查询返回DataSet
        /// </summary>
        /// <param name="Model"></param>
        /// <returns></returns>
        DataSet GetPageDataSet(IDataModel Model, ref int DataTotalCount);

        /// <summary>
        /// 根据指定条件获取对应Model
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="Model"></param>
        /// <returns></returns>
        T GetModel<T>(IDataModel Model) where T : IDataModel, new();
        #endregion

        #region 新增
        /// <summary>
        /// 新增记录
        /// </summary>
        /// <returns>返回新增后的实体</returns>
        T InsertReturnModel<T>(IDataModel Model) where T : IDataModel, new();

        /// <summary>
        /// 新增记录
        /// </summary>
        /// <returns>返回被影响行数</returns>
        int InsertReturnAffectRows(IDataModel Model);
        #endregion

        #region 删除

        /// <summary>
        ///  根据主键删除对应记录
        /// </summary>
        /// <returns>返回被影响行数</returns>
        int DeleteReturnAffectRows(IDataModel Model);
        #endregion

        #region 修改

        /// <summary>
        ///  根据主键修改对应记录
        /// </summary>
        /// <returns>返回被影响行数</returns>
        int UpdateReturnAffectRows(IDataModel Model);
        #endregion
        #endregion
    }
}
